using UnityGameFramework.Runtime;

namespace StarForce
{
    public sealed partial class InputModelComponent : GameFrameworkComponent
    {
        private float m_Horizontal;

        private float m_Vertical;

        private bool m_IsPageTouch;

        public bool IsPageTouch
        {
            get { return m_IsPageTouch; }
            set { m_IsPageTouch = value; }
        }


        public float Horizontal
        {
            get { return m_Horizontal; }
            set { m_Horizontal = value; }
        }
        public float Vertical
        {
            get { return m_Vertical; }
            set { m_Vertical = value; }
        }

        public void CloseInput()
        {
            m_Horizontal = 0;
            m_Vertical = 0;
        }

        private void Start()
        {
            IsPageTouch = false;
        }

        private void Update()
        {
            if (!IsPageTouch)
            {
                SetAxis();
            }
        }

        public void StartTouch(float speed)
        {
            IsPageTouch = true;
            m_Horizontal = speed;
        }

        public void EndTouch()
        {
            IsPageTouch = false;
            m_Horizontal = 0;
        }
    }
}